<!-- code mirror code http://codemirror.net/ -->
<script type="text/javascript" src="<?php echo base_url("js"); ?>/codemirror/lib/codemirror.js"></script>
<script src="<?php echo base_url("js"); ?>/codemirror/mode/xml/xml.js"></script>
<script src="<?php echo base_url("js"); ?>/codemirror/lib/util/javascript-hint.js"></script>
<script src="<?php echo base_url("js"); ?>/codemirror/mode/javascript/javascript.js"></script>
<script src="<?php echo base_url("js"); ?>/codemirror/mode/css/css.js"></script>
<script src="<?php echo base_url("js"); ?>/codemirror/mode/clike/clike.js"></script>
<script src="<?php echo base_url("js"); ?>/codemirror/mode/php/php.js"></script>
<script src="<?php echo base_url("js"); ?>/codemirror/lib/util/simple-hint.js"></script>
<link rel="stylesheet" href="<?php echo base_url("js"); ?>/codemirror/lib/util/simple-hint.css">
<link rel="stylesheet" href="<?php echo base_url("js"); ?>/codemirror/lib/codemirror.css">

<style>

br
{
	clear:both;
}
label {
	float:left;
}
input
{
	float:left;
}
textarea
{
	width:100%;
	height:35%;

}

</style>
<script>

$(function(){

	/* building buttons and attach click events */
	$( "#btnNewsCreateNew" ).button({
		icons: {
			primary: "ui-icon-circle-plus"
		},
		text: true
    });
	$( "#btnNewsBack" ).button({
		icons: {
			primary: "ui-icon-arrowreturnthick-1-w"
		},
		text: true
    });

	editor_short = CodeMirror.fromTextArea(document.getElementById("txtDesc"), {
		lineNumbers: true,
		matchBrackets: true,
		mode: "application/x-httpd-php",
		indentUnit: 4,
		indentWithTabs: true,
		enterMode: "keep",
		tabMode: "shift",
		extraKeys: {"Ctrl-Space": function(cm) {CodeMirror.simpleHint(cm, CodeMirror.javascriptHint);}}
	});

	$('.CodeMirror').addClass('ui-widget ui-widget-content ui-corner-all');
	$('.CodeMirror').css('font-size', '13px');
<?php if (!empty($error)) { ?>
	$('.CodeMirror-scroll').css('height', '150px');
<?php } else { ?>
	$('.CodeMirror-scroll').css('height', '150px');
<?php } ?>
});
</script>

<?php if (!empty($error)) { ?>
<div class="ui-state-error ui-corner-all" style="padding: 0 .7em;">
	<p><span class="ui-icon ui-icon-alert" style="float: left; margin-right: .3em;"></span>
	<strong>Внимание:</strong> <?php echo $error; ?></p>
</div>
<?php } ?>

<input type="hidden" name="act" value="new">

<?php if (isset($request['id'])) { ?>
<input type="hidden" name="id" value="<?php echo $request['id']; ?>">
<?php } ?>

<label>Имя канала ( краткий идентификатор )</label><br>
<input type="text" maxlenght="200px" name="name" style="width:100%;" value="<?php
if (isset($request['name']))
{
	echo(htmlentities($request['name'], ENT_COMPAT, 'UTF-8'));
}
?>"><br>

<label>Название</label><br>
<input type="text" maxlenght="200px" name="title" style="width:100%;" value="<?php
if (isset($request['title']))
{
	echo(htmlentities($request['title'], ENT_COMPAT, 'UTF-8'));
}
?>"><br>
<label style="margin-left:10px; width:auto">Активный</label><input type="checkbox" name="active" value="on" <?php
if (isset($request['active']) && ($request['active'] == 'on' || $request['active'] == 'true') )
{
	echo "checked";
}
?>><br>
<label>Описание ( пояснение о чем новосной канал )</label><br><textarea name="description" id="txtDesc"><?php
if (isset($request['description']))
{
	echo(htmlentities($request['description'], ENT_COMPAT, 'UTF-8'));
}
?></textarea><br>
<button name="cmd" value="create_channel" id="btnNewsCreateNew">
<?php if (isset($request['id'])) { ?>
Сохранить канал
<?php } else { ?>
Создать канал
<?php } ?>
</button>
<a id="btnNewsBack" href="<?php echo base_url("admin/tools/exec_tools/News/channels");?>">Нет спасибо, в другой раз</a>